package com.hpe.fastfood.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hpe.fastfood.mapper.LoginMapper;
import com.hpe.fastfood.pojo.Bussiness;
import com.hpe.fastfood.pojo.User;
import com.hpe.fastfood.service.LoginService;

/**
 * @ClassName: LoginServiceImpl
 * @Description:TODO 登陆注册
 * @author: sunwen
 * @date: 2018年11月22日 下午3:46:31
 */
@Service
public class LoginServiceImpl implements LoginService {

	@Autowired
	private LoginMapper loginMapper;

	@Override
	public User loginUser(String name, String pwd) {
		// TODO Auto-generated method stub
		return loginMapper.loginUser(name, pwd);
	}

	@Override
	public Bussiness loginBussiness(String name, String pwd) {
		// TODO Auto-generated method stub
		return loginMapper.loginBussiness(name, pwd);
	}

	@Override
	public int checkUsername(String userName) {
		// TODO Auto-generated method stub
		int res = loginMapper.checkUsername(userName);
		if (res > 0) {// 姓名重复
			res = 1;
		} else {// 姓名不重复
			res = 0;
		}
		return res;
	}

	@Override
	public int registerUser(User user) {
		// TODO Auto-generated method stub
		return loginMapper.registerUser(user);
	}

	@Override
	public int checkBussname(String bussinessName) {
		// TODO Auto-generated method stub
		int res = loginMapper.checkBussname(bussinessName);
		if (res > 0) {// 姓名重复
			res = 1;
		} else {// 姓名不重复
			res = 0;
		}
		return res;
	}

	@Override
	public int registerBuss(Bussiness bussiness) {
		// TODO Auto-generated method stub
		return loginMapper.registerBuss(bussiness);
	}
}
